/**
 * 
 */

/**
 * @author Parasuraman Ramakrishnan
 * Assignment Name: Homework1
 * Completed Date: 9/14/2009
 *
 */

package StudentPackage;

import moreHealthModel.Student.Student;
import moreHealthModel.Student.Student.Disease;
import moreHealthModel.Student.Student.Weight;
import moreHealthModel.Student.Student.WeightByHeight;
import junit.framework.TestCase;

public class TestStudentClass extends TestCase
	{
		Student s1;
		Student s2;
		Student s3;
		Student s4;
		Student s5;
		Student s6;
		Student s7;
		Student s8;
		Student s9;
		Student s10;
		Student s11;
		public void setUp() throws Exception
			{	
				s1= new Student("Aloke", 14, 4, 300, Disease.diabetes);//Valid
				s2= new Student("Parshu", 01, 007, 00300, Disease.heartTrouble);//Valid
				s6= new Student(" sss sse", 14,5,250, Disease.other);//Valid
				
				s3= new Student(null,0, 0, 0, Disease.other);//Invalid
				s4= new Student(null,-999, -999, -999, Disease.diabetes);//Invalid
				s5= new Student("Read",-999, 999, -999,Disease.heartTrouble );//Invalid
				s10= new Student("Read",999, 3, 80, Disease.heartTrouble );//Invalid
//				s11= new Student("Read",14, 5, 250,null);//Invalid
				
				
				s7= new Student(" ", 14,5,250, Disease.diabetes);//Invalid
				s8= new Student("", 14,5,250, Disease.heartTrouble );//Invalid
				s9 = new Student("Parshu", 7/2, 0/2, 999, Disease.other);
			}
		
		public void testStudentInfoSetting()
			{
				//To check if the student Info is valid. If the value is true then something is wrong.
				//Rules of Validity are:
				//1. Age>0
				//2. StudentName !=null or blank
				//3. MinimumHeight<=StudentHeight<=MaxHeight
				//4. MinimumWeight<=StudentWeight<=MaxWeight
				
				//Legal Combination
				assertEquals(false, s1.getstudentInfoStatus());
				assertEquals(false, s2.getstudentInfoStatus());
				assertEquals(false, s6.getstudentInfoStatus());
				assertEquals(true,  s7.getstudentInfoStatus());
				assertEquals(true,  s8.getstudentInfoStatus());
				
				//Random Cases
				assertEquals(true, s3.getstudentInfoStatus());
				//assertEquals(true, s11.getstudentInfoStatus());
				
				//Extreme Case
				assertEquals(true, s4.getstudentInfoStatus());
				assertEquals(true, s5.getstudentInfoStatus());
				assertEquals(true, s10.getstudentInfoStatus());
			}
		
		public void testWeightFactorByHeight()
			{
				
				//Legal Combination
				assertEquals(Weight.Normal, s1.WeightFactorByHeight(1, 20));
				assertEquals(Weight.Overweight, s1.WeightFactorByHeight(3, 70));
				
				//Corner Cases
				assertEquals(Weight.InvalidWeight, s1.WeightFactorByHeight(2, 999));
				assertEquals(Weight.InvalidWeight, s1.WeightFactorByHeight(999, 999));
				
				//Random
				assertEquals(Weight.InvalidWeight, s1.WeightFactorByHeight(-1, 999));
				assertEquals(Weight.InvalidWeight, s1.WeightFactorByHeight(-10000, -999));
			}
		
		public void testEnumWeight()
			{
				//Legal Combination: Enum Weight
				assertEquals(1, Weight.Normal.getStudentWeightLevel());
				assertEquals(999, Weight.InvalidWeight.getStudentWeightLevel());
			}
		
		public void testEnumWeightByHeight()
			{
				//Legal Combination: Enum WeightByHeight
				assertEquals(100, WeightByHeight.Five.GetStudentWeight());
				assertEquals(999, WeightByHeight.Invalid.GetStudentWeight());
			}
		
		public void testEnumDisease()
			{
				//Legal Combination: Disease
				assertEquals(5, Disease.diabetes.getDiseaseCode());
				assertEquals(4, Disease.heartTrouble.getDiseaseCode());	
			}

		public void testCalcSeriousnessFactor()
			{
				
				//Legal Combination
				assertEquals(7, s1.CalcSeriousnessFactor(s1));
				assertEquals(6, s2.CalcSeriousnessFactor(s2));
				assertEquals(4, s6.CalcSeriousnessFactor(s6));

				//Corner Cases
				assertEquals(0, s3.CalcSeriousnessFactor(s3));
				assertEquals(0, s4.CalcSeriousnessFactor(s4));
				assertEquals(0, s5.CalcSeriousnessFactor(s5));
				
				//Random
				assertEquals(0, s7.CalcSeriousnessFactor(s7));
				assertEquals(0, s8.CalcSeriousnessFactor(s8));
				assertEquals(0, s9.CalcSeriousnessFactor(s9));

		
			}

		public void tearDown() throws Exception
			{
			}

	}
